﻿<cfsilent>
	<cfscript>
		
		event.setArg("pageTitle", "教学质量评价 - 评价指标体系设置向导");
		
		currentTab = event.getArg("TabID", "labCourse");
		
		termId = event.getArg("TermID");
		evsId = event.getArg("ES");
		
		passArgs = structNew();
		structInsert( passArgs, "ES", evsId );
		structInsert( passArgs, "TID", termId );
		
		/* 评价体系相关设置 */
		sql = "SELECT 
				es_name, es_model, es_level 
				FROM t_evaluate_system 
				WHERE 
					es_id = :evsId ";
		
		queryObj = new Query( datasource=application.dnsSlave );
		queryObj.addParam( name="evsId", value=evsId, cfsqltype="cf_sql_char" );

		rs_evs = queryObj.execute( sql=sql ).getResult();
		
		/* 读取评价体系已关联课堂 */
		sql = "SELECT 
				cid, course_name, course_code, 
				course_credit, 
				period, period_theory, period_practice, period_computer, 
				t_institute.institute_short
				FROM t_course 
				INNER JOIN t_institute ON t_institute.institute_id = t_course.institute_id 
				WHERE 
					EXISTS ( 
						SELECT 1 FROM t_course_evaluate 
						WHERE 
							t_course_evaluate.es_id = :evsId 
							AND 
							t_course_evaluate.cid = t_course.cid 
					) 
				ORDER BY t_institute.institute_short, course_name ";
		
		queryObj = new Query( datasource=application.dnsSlave );
		queryObj.addParam( name="evsId", value=evsId, cfsqltype="cf_sql_char" );

		rs_course = queryObj.execute( sql=sql ).getResult();
					
	</cfscript>
</cfsilent>

<div id="headArea">
	<div class="uiHeader uiHeaderWithImage ptm">
		<div class="clearfix uiHeaderTop">
			<div class="uiHeaderActions rfloat">
				<a class="uiButton" href="<cfoutput>#buildURL('evaluateSystem')#</cfoutput>"><i class="mrs img btnList"></i><span class="uiButtonText">评价指标体系</span></a>
			</div>
			<div>
				<h2 class="uiHeaderTitle">
					<i class="uiHeaderImage img icon16x16 card"></i>评价指标体系设置向导
				</h2>
			</div>
		</div>
	</div>
</div>

<!--- 加载导航菜单 --->
<!-- stepMenu-->
<cfoutput>#event.getArg("stepMenu")#</cfoutput>
<!--/stepMenu-->

<div class="UIElement">
	<ul class="senateFirstPage">
		<li>
			<div class="clearfix" id="summary">
				<div class="UItab">
					<div class="tabLables">
						<span <cfif currentTab eq "labCourse">class="active"</cfif> id="labCourse" tabTarget="Course">已关联课堂</span>
						<span <cfif currentTab eq "labAttach">class="active"</cfif> id="labAttach" tabTarget="Attach">关联新课程</span>
					</div>
				</div>
				<script language="javascript" type="text/javascript">
					//<![CDATA[
					<!--
					$(document).ready(function() {
						
						/* init Tab */
						$("div.tabContent").hide();
						$("div#" + $("div.tabLables span.active").attr("tabTarget")).show();
						
						$("div.tabLables > span").click(function(){
							var $targetID = $(this).attr("tabTarget");
							
							$("div.tabLables span").removeClass("active");
							$(this).addClass("active");
							
							$("div.tabContent").not('[id="' + $targetID + '"]').hide();
							$("div.tabContent#" + $targetID).show();
						});
						
					});
					// -->
					//]]>				
				</script>
				
				<div id="Course" class="tabContent">
					
					<div class="noticeBlock">
						<div class="operation">
							<a class="uiButton" href="<cfoutput>#buildURL('evaluateSystemSetupWizardQuestion', passArgs)#</cfoutput>"><i class="mrs img btnExecute"></i><span class="uiButtonText">修改题目</span></a>
							<a class="uiButton" href="<cfoutput>#buildURL('evaluateSystemSetupWizardPreview', passArgs)#</cfoutput>"><i class="mrs img btnList"></i><span class="uiButtonText">预览</span></a>
						</div>
						<h3><cfoutput>#rs_evs.es_name#</cfoutput></h3>
						<p><span class="img icon16x16 message"></span>只有关联了该评教体系的课程, 才能使用该评价标准进行评价.</p>
						<hr/>
					</div>

					<cfif rs_course.recordCount>
							
							<table class="UIEditable">
								<thead>
									<tr>
										<td width="18"></td>
										<td width="60">任课单位</td>
										<td width="80">课程号</td>
										<td>课程</td>
										<td width="48" align="center">学分</td>
										<td width="48" align="center">总学时</td>
										<td width="36" align="center">理论</td>
										<td width="36" align="center">实践</td>
										<td width="36" align="center">上机</td>
										<td width="18"></td>
									</tr>
								</thead>
								<tbody>
									<cfset row = 0 />
									<cfloop query="rs_course">
									
										<cfset row++ />
										<cfset structInsert( passArgs, "CID", rs_course.cid,  true ) />
										
										<tr class="editRows">
											<td><span class="index"><cfoutput>#row#</cfoutput></span></td>
											<td><cfoutput>#rs_course.institute_short#</cfoutput></td>
											<td><span class="numeric"><cfoutput>#rs_course.course_code#</cfoutput></span></td>
											<td><cfoutput>#rs_course.course_name#</cfoutput></td>
											<td align="center"><span class="numeric"><cfoutput>#numberFormat(rs_course.course_credit, "0.0")#</cfoutput></span></td>
											<td align="center"><span class="numeric"><cfoutput>#rs_course.period#</cfoutput></span></td>
											<td align="center"><span class="numeric"><cfif rs_course.period_theory><cfoutput>#rs_course.period_theory#</cfoutput><cfelse>-</cfif></span></td>
											<td align="center"><span class="numeric"><cfif rs_course.period_practice><cfoutput>#rs_course.period_practice#</cfoutput><cfelse>-</cfif></span></td>
											<td align="center"><span class="numeric"><cfif rs_course.period_computer><cfoutput>#rs_course.period_computer#</cfoutput><cfelse>-</cfif></span></td>
											<td><a class="stat delete" href="<cfoutput>#buildURL('evaluateSystemSetupWizardCourseRemoveDo', passArgs)#</cfoutput>"></a></td>
										</tr>
										
									</cfloop>
									
									<!--- 移出参数 --->
									<cfset structDelete( passArgs, "CID" ) />
									
								</tbody>
							</table>
							
						<cfelse>
							
							<div class="systemNotice">
								<h3>尚未关联课堂</h3>
								<p class="mln">还没有设置使用该教学质量评价体系的课程</p>
							</div>

					</cfif>
					
				</div>
				
				<div id="Attach" class="tabContent">
					
					<div class="noticeBlock">
						<div class="operation">
							<a class="uiButton uiButtonSpecial" href="<cfoutput>#buildURL('courseOpeningDownloadExcel', passArgs)#</cfoutput>"><i class="mrs img btnDownload"></i><span class="uiButtonText">下载开课目录</span></a>
						</div>
						<h3>关联课程</h3>
						<p><span class="img icon16x16 message"></span>注意, 一门课程只能使用一个评价体系, 如果这里填写的课程代码已关联了其他课程, 则该课程将变更为使用当前指定的课程体系</p>
						<hr/>
					</div>
					
					<form id="formAttach" onSubmit="javascript:return processVerfiyForm('formAttach');" class="formWrapper" method="post" action="<cfoutput>#buildURL('evaluateSystemSetupWizardCourseAttachDo')#</cfoutput>">
						
						<input name="ES" type="hidden" value="<cfoutput>#evsId#</cfoutput>" />
						
						<div class="label">
							<b>课程号</b>
							<textarea name="CourseCodes" id="CourseCodes" verification="required"></textarea>
							<p class="notice">请在这里填写要关联课程的课程号, 多个课程号使用 , 或 换行 进行分割</p>
						</div>
						
						<hr/>
						
						<div class="lable">
							<input class="button" type="submit" value="更新" />
						</div>
						
					</form>
					
				</div>

			</div>
		</li>
	</ul>
</div>